#include "CollisionCallBack.h"
PlayerDansCollisionCallback::PlayerDansCollisionCallback(Player* player):
_player(player)
{}
PlayerDansCollisionCallback::~PlayerDansCollisionCallback(){}
int PlayerDansCollisionCallback::onAABBOverlap( OgreNewt::Body* body0, OgreNewt::Body* body1, int threadIndex )
{

	//if(body0->getType() == 10)
	//{
	//	body0->setVelocity(Ogre::Vector3(0,0,0));
	//	body0->removeForceAndTorqueCallback();
	//	body0->setStandardForceCallback();
	//	//_player->_isTouched = true;//touched
	//	//_player->_isBlockTar = false;

	//}else
	//{
	//	body1->setVelocity(Ogre::Vector3(0,0,0));
	//	body1->removeForceAndTorqueCallback();
	//	body1->setStandardForceCallback();
	//	_player->_isTouched = true;//touched
	//	_player->_isBlockTar = false;
	//}
	return 1;
}
void PlayerDansCollisionCallback::contactsProcess( OgreNewt::ContactJoint &contactJoint, Ogre::Real timeStep, int threadIndex )
{
	if(contactJoint.getBody0()->getType() == 10)
	{
		contactJoint.getBody0()->setVelocity(Ogre::Vector3(0,0,0));
		contactJoint.getBody0()->removeForceAndTorqueCallback();
		contactJoint.getBody0()->setStandardForceCallback();
		_player->_isTouched = true;//touched
		_player->_isBlockTar = false;
		
	}else
	{
		contactJoint.getBody1()->setVelocity(Ogre::Vector3(0,0,0));
		contactJoint.getBody1()->removeForceAndTorqueCallback();
		contactJoint.getBody1()->setStandardForceCallback();
		_player->_isTouched = true;//touched
		_player->_isBlockTar = false;
	}
}